Trò chơi đua xe động vật trong UNITY Engine
114.618 lượt xem;
- SkillClickListener.cs
- ShopScreen /
- AnimalRacing /
- Scripts /
- Assets /
- project /
1 using UnityEngine;
2 using System.Collections;
3
4 public class SkillClickListener : InputAdapter
5 {
6 public int skillIndex;
7 public SkillDescription skillDescription;
8 public Descriptions descriptions;
9 public int starUnlock;
10 public CirclesChoosed circleChoosed;
11
12 public Vector3 oldPosition;
13 public bool picked;
14 public int cirlceIndex;
15
16 public void Start()
17 {
18 oldPosition = gameObject.transform.localPosition;
19 }
20
21 public override void OnTouchDown()
22 {
23 if (InputController.Name != InputNames.SHOP) return;
24 base.OnTouchDown();
25 gameObject.GetComponent<SpriteRenderer>().color = new Color(0.5f, 0.5f, 0.5f, 1);
26 SoundManager.playButtonSound();
27 }
28 public override void OnCheckUp()
29 {
30 if (InputController.Name != InputNames.SHOP) return;
31 base.OnCheckUp();
32 gameObject.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 1);
33 }
34 public override void OnTouchUp()
35 {
36 if (InputController.Name != InputNames.SHOP) return;
37 base.OnTouchUp();
38 descriptions.setText(skillDescription.getDesciptions1(skillIndex), skillDescription.getDesciptions2(skillIndex), skillDescription.getName(skillIndex), starUnlock);
39 circleChoosed.choosedSkill(gameObject, skillIndex, starUnlock);
40 }
41 }
2 using System.Collections;
3
4 public class SkillClickListener : InputAdapter
5 {
6 public int skillIndex;
7 public SkillDescription skillDescription;
8 public Descriptions descriptions;
9 public int starUnlock;
10 public CirclesChoosed circleChoosed;
11
12 public Vector3 oldPosition;
13 public bool picked;
14 public int cirlceIndex;
15
16 public void Start()
17 {
18 oldPosition = gameObject.transform.localPosition;
19 }
20
21 public override void OnTouchDown()
22 {
23 if (InputController.Name != InputNames.SHOP) return;
24 base.OnTouchDown();
25 gameObject.GetComponent<SpriteRenderer>().color = new Color(0.5f, 0.5f, 0.5f, 1);
26 SoundManager.playButtonSound();
27 }
28 public override void OnCheckUp()
29 {
30 if (InputController.Name != InputNames.SHOP) return;
31 base.OnCheckUp();
32 gameObject.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 1);
33 }
34 public override void OnTouchUp()
35 {
36 if (InputController.Name != InputNames.SHOP) return;
37 base.OnTouchUp();
38 descriptions.setText(skillDescription.getDesciptions1(skillIndex), skillDescription.getDesciptions2(skillIndex), skillDescription.getName(skillIndex), starUnlock);
39 circleChoosed.choosedSkill(gameObject, skillIndex, starUnlock);
40 }
41 }